<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> 
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> 
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/translator.tld" prefix="trans" %>
<trans:initPage module="search2" />
<table width="95%">
<tr>
<!--MENU-->
<td valign=top>
<table width="90%" align="center" cellpadding="5" cellspacing="1" border="0" bgcolor="#3399CC">
 <tr>
    <td class="textalb">
    Search Form
    </td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td class="text_search" align=center>
<html:form action="/search">

<html:hidden property="alerterId"/>
<html:hidden property="sector"/>
<html:hidden property="fundingOrg"/>
<html:hidden property="contractingOrg"/>
<html:hidden property="beneficiaryOrg"/>
<html:hidden property="donorOrg"/>
<html:hidden property="involvedPerson"/>
<html:hidden property="mode" value=""/>
<html:hidden property="extern_modifier" value="x"/>
<html:hidden property="sector_id" value=""/>
<html:hidden property="loc_countryiso3"/>
<html:hidden property="loc_countyId"/>
<html:hidden property="loc_townId"/>
<html:hidden property="loc_villageId"/>
<html:hidden property="loc_cregionId"/>
<html:hidden property="loc_regionId"/>


<table bgcolor="#F0F0F0" class="text">
	<tr bgcolor="#FFFFFF">
		<td align=right>
		<b><trans:showPageMessage label="sector" />:</b>
		</td>
		<td>
<input class="buton" type="button" value="<trans:showPageMessage label="select" hide_link="true" />" onclick="javascript:document.projectSearchForm.extern_modifier.value 
                  = 'sector';select_sector();"/> <logic:present name="Sector"> 
                  <bean:write name="Sector" property="title"/> </logic:present> 
                  <logic:notPresent name="Sector"> 	<trans:showPageMessage label="nosector" /></logic:notPresent> 
                  
                  </td>
	</tr>
	<tr bgcolor="#FFFFFF">
		<td align=right>
		<b><trans:showPageMessage label="fundingorg" />:</b>
		</td>
		<td>
<input class="buton" type=button value="<trans:showPageMessage label="select" hide_link="true" />" onclick="javascript:document.projectSearchForm.extern_modifier.value = 'funding';open_orgs();"/>
		<logic:present name="FundingOrg">
			<bean:write name="FundingOrg" property="name"/>
		</logic:present>
		<logic:notPresent name="FundingOrg">
			<trans:showPageMessage label="nofundingorgsel" />
		</logic:notPresent>
		</td>
	</tr>
	
	<tr bgcolor="#FFFFFF">
		<td align=right>
		<b><trans:showPageMessage label="contractingorg" />:</b>
		</td>
		<td>
<input class="buton" type=button value="<trans:showPageMessage label="select" hide_link="true" />" onclick="javascript:document.projectSearchForm.extern_modifier.value = 'contracting';open_orgs();"/>
		<logic:present name="ContractingOrg">
			<bean:write name="ContractingOrg" property="name"/>
		</logic:present>
		<logic:notPresent name="ContractingOrg">
			<trans:showPageMessage label="nocontractingorgsel" /></logic:notPresent>
		</td>

	</tr>
	
	
	<tr bgcolor="#FFFFFF">
		<td align=right>
		<b><trans:showPageMessage label="benorg" />:</b>
		</td>
		<td>
<input class="buton" type=button value="<trans:showPageMessage label="select" hide_link="true" />" onclick="javascript:document.projectSearchForm.extern_modifier.value = 'beneficiary';open_orgs();"/>
		<logic:present name="BeneficiaryOrg">
			<bean:write name="BeneficiaryOrg" property="name"/>
		</logic:present>
		<logic:notPresent name="BeneficiaryOrg">
			<trans:showPageMessage label="nobenorgsel" />
		</logic:notPresent>

		</td>
	</tr>
	
	<tr bgcolor="#FFFFFF">
		<td align=right>
		<b><trans:showPageMessage label="donororg" />:</b>
		</td>
		<td>
<input class="buton" type=button value="<trans:showPageMessage label="select" hide_link="true" />" onclick="javascript:document.projectSearchForm.extern_modifier.value = 'donor';open_orgs();"/>
		<logic:present name="DonorOrg">
			<bean:write name="DonorOrg" property="name"/>
		</logic:present>
		<logic:notPresent name="DonorOrg">
			<trans:showPageMessage label="nodonorsel" />
		</logic:notPresent>
		</td>
	</tr>
		
	<tr bgcolor="#FFFFFF">
		<td align=right>
		<b><trans:showPageMessage label="invpers" />:</b>
		</td>
		<td>
<input class="buton" type=button value="<trans:showPageMessage label="select" hide_link="true" />" onclick="javascript:document.projectSearchForm.extern_modifier.value = 'person';open_pers();"/>
		<logic:present name="Person">
			<bean:write name="Person" property="name"/>
		</logic:present>
		<logic:notPresent name="Person">
			<trans:showPageMessage label="noinvpersel" />
		</logic:notPresent>

		</td>
	</tr>
	<tr bgcolor="#FFFFFF">
		<td align=right>
		<b><trans:showPageMessage label="projstatus" />:</b>
		</td>
		<td>
		<html:select property="status">
		<html:option value="-1"><trans:showPageMessage label="selstatus" hide_link="true" /></html:option>
		<html:options collection="Status_LIST" property="id" labelProperty="status" filter="false"/>
		</html:select>
		</td>
	</tr>
	
	<tr bgcolor="#FFFFFF">
		<td align=right>
		<b><trans:showPageMessage label="title" />:</b>
		</td>
		<td>
		<html:text size="60" property="title" styleClass="text"/>
		</td>
	</tr>
		
	<tr bgcolor="#FFFFFF">
		<td align=right>
		<b><trans:showPageMessage label="desc" />:</b>
		</td>
		<td>
		<html:text size="60" property="description" styleClass="text"/>
		</td>
	</tr>
	
		<tr bgcolor="#FFFFFF">
		<td align=right>
		<b><trans:showPageMessage label="key" />:</b>
		</td>
		<td>
		<html:text size="60" property="keywords" styleClass="text"/>
		</td>
	</tr>
	
	<tr bgcolor="#FFFFFF">
		<td align=right>
		<b><trans:showPageMessage label="location" />:</b>
		</td>
		<td>
<input class="buton" type=button value="<trans:showPageMessage label="select" hide_link="true" />" onclick="javascript:document.projectSearchForm.extern_modifier.value = 'location';open_locations();"/>
		<logic:present name="Location">
		<br>
		<logic:present name="Location" property="cregion">
			<bean:write name="Location" property="cregion.name" />
		</logic:present>
		<logic:present name="Location" property="country">
			&nbsp;-&nbsp;<bean:write name="Location" property="country.name"/>
		</logic:present>
		<logic:present name="Location" property="region">
			&nbsp;-&nbsp;<bean:write name="Location" property="region.name" />
		</logic:present>
		<logic:present name="Location" property="judet">
			&nbsp;-&nbsp;<bean:write name="Location" property="judet.name"/>
		</logic:present>
		<logic:present name="Location" property="oras">
			&nbsp;-&nbsp;<bean:write name="Location" property="oras.name"/>
		</logic:present>
		<logic:present name="Location" property="localitate">
			&nbsp;-&nbsp;<bean:write name="Location" property="localitate.name"/><br>
		</logic:present>
			
		</logic:present>
		<logic:notPresent name="Location">
			<trans:showPageMessage label="nolocation" />
		</logic:notPresent>
		
		</td>
	</tr>
	
	
	<tr bgcolor="f2f2f2">
		
		<td height="40" colspan="2" align="center">
		
		<trans:showPageMessage label="resultsformat" />
		<html:select property="formatId">
		<html:options collection="formats" property="id" labelProperty="name"/>
		</html:select>
		
		
			<html:submit styleClass="butonsave" property="search" onclick="document.projectSearchForm.mode.value='search';">
			  <trans:showPageMessage label="search" hide_link="true" />
			  </html:submit>
			<html:submit styleClass="butonsave" property="clear" onclick="document.projectSearchForm.mode.value='clear';">
			  <trans:showPageMessage label="clear" hide_link="true" />
			  </html:submit>
			  <br>
			  <input type=button class=buton 
    onclick=javascript:window.location.href='<html:rewrite page="/resultsFormat.do"/>?mode=list';
    value="<trans:showPageMessage label="editformats" hide_link="true" />" />
			  
			
			<p>	
		</td>
	</tr>

</table>

<script language="javascript">
	function open_locations() {
         window.open('<html:rewrite page="/location/browser.do?action=new"  />',
                                    'loc_selector',
                                    'status=yes,WIDTH=600,HEIGHT=400,scrollbars=yes');
	};
	
    function open_orgs() {
        ed_donor_orgs_win = window.open(
        '<html:rewrite page="/org/selector.do"/>',
        'ed_donor_win', 'HEIGHT=400,WIDTH=500,scrollbars=yes');
    };
    
    function after_org_sel() {
       document.projectSearchForm.submit();
    };
    
    
    function after_pers_sel() {
       document.projectSearchForm.submit();
     };
    
    function add_location(cregion_id,country_iso3,region_id,county_id,town_id,village_id) {
       document.projectSearchForm.loc_countryiso3.value=country_iso3;
       document.projectSearchForm.loc_countyId.value=county_id;
       document.projectSearchForm.loc_townId.value=town_id;
       document.projectSearchForm.loc_regionId.value=region_id;
       document.projectSearchForm.loc_cregionId.value=cregion_id;
       document.projectSearchForm.loc_villageId.value=village_id;
       document.projectSearchForm.submit();
     };
                  
    
    
    function add_sector(dac5, crs) {
	       if (crs!=-1) {
        document.projectSearchForm.sector_id.value=crs;
		
      } else
      if (dac5!=-1) {
        document.projectSearchForm.sector_id.value=dac5;
      } else
      document.projectSearchForm.sector_id.value=-1;
	    document.projectSearchForm.submit();
	};
 
	function select_sector() {
      window.open("<html:rewrite page="/sectors/browser.do" />", "sector_selector",
            "status=yes,WIDTH=700,HEIGHT=400,scrollbars=yes");
	};
	
	function open_pers() {
          ed_pers_win = window.open("<html:rewrite page="/pers/selector.do?"/>?perskey=Prjfilter_Person", "ed_win", "HEIGHT=400,WIDTH=500,scrollbars=yes");

     };
	
</script>	
	
</html:form>

</td></tr>

</table>
</td>
</tr>

</table><trans:showPageMessage label="translator.showhiddentags"/>